package com.zhsh.generator.template.engine;

import com.zhsh.generator.common.utils.ToolUtil;

/**
 * 通用的模板生成引擎
 *
 * @author fengshuonan
 * @date 2017-05-09 20:32
 */
public class SimpleTemplateEngine extends AbstractGunsTemplateEngine {

    @Override
    protected void generateController() {
        String controllerPath = ToolUtil.format(super.getContextConfig().getProjectPath() + super.getControllerConfig().getControllerPathTemplate(),
                super.getContextConfig().getBizEnBigName());
        generateFile("template/Controller.java.btl", controllerPath);
        System.out.println("生成"+super.getContextConfig().getBizEnBigName()+"Controller成功!");
    }

    @Override
    protected void generateService() {
        String servicePath = ToolUtil.format(super.getContextConfig().getProjectPath() + super.getServiceConfig().getServicePathTemplate(),
                super.getContextConfig().getBizEnBigName());
        generateFile("template/Service.java.btl", servicePath);
        System.out.println("生成"+super.getContextConfig().getBizEnBigName()+"Service成功!");

        String serviceImplPath = ToolUtil.format(super.getContextConfig().getProjectPath() + super.getServiceConfig().getServiceImplPathTemplate(),
                super.getContextConfig().getBizEnBigName());
        generateFile("template/ServiceImpl.java.btl", serviceImplPath);
        System.out.println("生成"+super.getContextConfig().getBizEnBigName()+"ServiceImpl成功!");
    }
}
